<include file="Public:header" />
<script type="text/javascript" src="__PUBLIC__/js/kindeditor-all-min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/zh_CN.js"></script>
<script src="__PUBLIC__/js/PCASClass.js" type="text/javascript"></script>
<script type="text/javascript" src="__PUBLIC__/js/formValidator-4.0.1.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="__PUBLIC__/js/formValidatorRegex.js" charset="UTF-8"></script>
<link rel="stylesheet" href="__PUBLIC__/css/kindeditor.css" type="text/css" />

<div class="container">
    <!-- Docs nav ================================================== -->
    <div class="page-header">
        <h4>{:L('DECISIONMAKER')}</h4>
    </div>
    <div class="row">
        <div class="span12">
            <include file="Public:alert" />
            <form id="form1" action="{:U(customer/decisionmaker)}" method="post">
                <table class="table" width="95%" border="0" cellspacing="1" cellpadding="0">
                    <tbody>
                    <tr style="display: none;">
                        <td class="tdleft" width="15%">{:L('PRINCIPAL')}:</td>
                        <td>
                            <input type="hidden" id="owner_id" name="owner_role_id" value="{$Think.session.role_id}"/>
                            <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                        <td><input type="text" id="customer_id" name="customer_id" value="{$customer_id}" readonly></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('CHANCE_ID')}:</td>
                        <td>
                            <select style="width: 22%;" id="chance_id" onchange="changeCondition()" name="chance_id">
                                <option class="" value="">--{:L('PLEASE_CHOOSE_CHANGE_ID')}--</option>
                                <volist name="rs_business" id="vo">
                                    <option class="" value="{$vo.business_id}" rel="customer">{$vo.name}</option>
                                </volist>
                            </select>&nbsp;&nbsp;
                        </td>
                    </tr>
<!--                    <tr>
                        <td class="tdleft" width="15%">{:L('ORGANIZATION_NAME')}:</td>
                        <td><input type="text" id="organization_name" name="organization_name" value=""></td>
                    </tr>-->
                    <tr>
                        <td class="tdleft" width="15%">{:L('DECISION_MAKER')}:</td>
                        <td><input type="text" id="decision_maker" name="decision_maker" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('PARTION')}:</td>
                        <td><input type="text" id="partion" name="partion" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('CONNECTION')}:</td>
                        <td><input type="text" id="connection" name="connection" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('FAMILY_MEMBER')}:</td>
                        <td><input type="text" id="family_member" name="family_member" value=""></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('HOBBY')}:</td>
                        <td><input type="text" id="hobby" name="hobby" value=""></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('DECISION_SEX')}:</td>
                        <td>
                            <select style="width: 22%;" id="decision_sex" onchange="changeCondition()" name="decision_sex">
                                <option class="" value="">--{:L('PLEASE_CHOOSE_DECISIONER_SEX')}--</option>
                                <option class="" value="0" rel="customer">男</option>
                                <option class="" value="1" rel="customer">女</option>
                            </select>&nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('DECISION_AGE')}:</td>
                        <td><input type="text" id="decision_age" name="decision_age" value=""></td>
                    </tr>
                    <tr>
                        <td class="tdleft" width="15%">{:L('DECISION_BIRTHDAY')}:</td>
                        <td><input type="text" value="" id="decision_birthday" style="width: 21%;" name="decision_birthday" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"></td>
                    </tr>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td style="text-align:left;" colspan="10">
                            <input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE')}"/>&nbsp;&nbsp;
                            <!--<input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE_AND_NEW')}"/>&nbsp;&nbsp;-->
                            <input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/>&nbsp;
                        </td>
                    </tr>
                    </tfoot>
                </table>
                <if condition="$leads['leads_id']"><input type="hidden" name="leads_id" value="{$leads['leads_id']}"/></if>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(){
//    $('#decision_maker').blur(
//            function(){
//                decision_maker=$('#decision_maker').val();
//                if(decision_maker!=''){
//                    $.post('{:U("customer/decision_maker_check")}',
//                            {
//                                name:decision_maker
//                            },
//                            function (data) {
//                                if(data.data!=0){
//                                    $result='';
//                                    $.each(data.data,function(k,v){
//                                        result += (k+1)+'、'+v+'</br>';
//                                    });
//                                    $('#dialog-validate').dialog('open');
//                                    $("#search_content").html($result);
//                                }
//                            },function,'json'
//                    );
//                }
//            }
//    )
});
$(function(){
    var decision_maker,partion,connection,family_member,hobby,decision_age;
    decision_maker=$("#decision_maker").val();
    partion=$("#partion").val();
    connection=$("#connection").val();
    family_member=$("family_member").val();
    hobby=$("#hobby").val();
    decision_age=$("decision_age").val();
    $("#decision_maker").on('blur',function(){
        if(decision_maker==''){
            alert("决策人信息不有为空");
        }
    });
    $("#connection").on('blur',function(){
        if(connection=='') {
            alert("联系方式不能为空");
        }else{
            var reg = /^0?1[3|4|5|8][0-9]\d{8}$/;
            if(!reg.test(connection)){
                alert("请输入正确的联系方式！")
            }
        }
    });
});
</script>
<include file="Public:footer" />